package com.coffee.wx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.coffee.wx.entity.business.WxFollowInfo;
import com.coffee.wx.mapper.WxFollowInfoMapper;
import com.coffee.wx.service.IWxFollowInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class WxFollowInfoServiceImpl extends ServiceImpl<WxFollowInfoMapper, WxFollowInfo> implements IWxFollowInfoService {

    @Resource
    private WxFollowInfoMapper followInfoMapper;

    @Override
    public long getCountByOpenId(String toOpenId) {
        return this.count(Wrappers.lambdaQuery(WxFollowInfo.class)
                .eq(WxFollowInfo::getOpenId, toOpenId));
    }

    @Override
    public List<Map<String, Object>> getRankingList() {
        return followInfoMapper.getRankingList();
    }
}
